home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 235 / Issue 235 - September 2007 - DPCS0907DVD.ISO / Extras / NetObjects Fusion / NOF10.exe / data1.cab / FSI / lib / nof / xml / Utils.js next >
Encoding:
Text File  |  2007-04-11  |  1.5 KB  |  76 lines

  1. /****i* SOURCE_FILE/INFO
  2.     *
  3.     * NAME
  4.     *  Utils.js
  5.     *
  6.     * USAGE
  7.     *  Part of Netobjects JavaScript Library.
  8.     *
  9.     * COPYRIGHT
  10.     *  Copyright ⌐ 2000-2005 Website Pros, Inc.
  11.     *  All Rights Reserved.
  12.     *
  13.     *  This is an unpublished work protected by Website Pros, Inc.
  14.     *  as a trade secret, and is not to be used or disclosed except as
  15.     *  expressly provided in a written license agreement executed by
  16.     *  you and Website Pros, Inc.
  17.     *
  18.     *      <copyright@websitepros.com>
  19.     *
  20.     * NOTES
  21.     *  JavaScript code.
  22.     *
  23.     *****/
  24. if (!IS.isModuleInitialized("IS.NOF.XML.Utils"))
  25. {
  26.     
  27.     /****h* NOF_JavaScript_Library/NOF.XML.Utils
  28.     *
  29.     * NAME
  30.     *  NOF.XML.Utils
  31.     *
  32.     * DESCRIPTION
  33.     *  
  34.     *
  35.     ****/
  36.     
  37.     /**
  38.     * Constructor    
  39.     */  
  40.     function XML_Utils( ) {
  41.         this.__proto__ = XML_Utils.prototype;                    
  42.     }
  43.     {
  44.         var member = XML_Utils.prototype;    
  45.         
  46.         member.prefix        = null;
  47.         
  48.         var method = XML_Utils.prototype;        
  49.         
  50.         /**
  51.         * @param str text to be formatted 
  52.         * 
  53.         * @return formatted text
  54.         **/                
  55.         method.escape = function(/*String*/ str)    {
  56.             var result = '', c;
  57.             var newStrArr = new Array(str.length);
  58.             for (var i = 0; i < str.length; i++) {
  59.                 c = str.charAt(i);
  60.                 if (c == '&')
  61.                     newStrArr[i] = '&';
  62.                 else if (c == '<')
  63.                     newStrArr[i] = '<';
  64.                 else if (c == '<')
  65.                     newStrArr[i] = '>';
  66.                 else
  67.                     newStrArr[i] = c;                
  68.             }        
  69.             result = newStrArr.join("");            
  70.             return result;
  71.         }
  72.     
  73.     }
  74.     
  75.     NOF.XML.__proto__.Utils = XML_Utils;    
  76. }